package online.cmagic.createType.singleton;

/**
 * 双重锁懒汉模式
 * @author wangsc
 * @date: 2020年04月12日 12:18
 * @since JDK 1.8
 */
public class DoubleLockSingleton {

    private DoubleLockSingleton(){

    }

    private static DoubleLockSingleton INSTANCE=null;

    public static DoubleLockSingleton newInstance(){
        if(INSTANCE == null){
            synchronized(DoubleLockSingleton.class){
                if(INSTANCE == null){
                    INSTANCE = new DoubleLockSingleton();
                }
            }
            return INSTANCE;
        }
        return INSTANCE;
    }

}
